from typing import *


class Solution:
    def maxSatisfied(
        self, customers: List[int], grumpy: List[int], minutes: int
    ) -> int:
        t, a, w = 0, 0, 0
        for i, (c, g) in enumerate(zip(customers, grumpy)):
            if g == 0:
                t += c
            else:
                w += c
            if i >= minutes and grumpy[i - minutes] == 1:
                w -= customers[i - minutes]
            a = max(a, w)
        return t + a
